home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / term / term_47a_pch.lha / Source / term-4.7a / About.c next >
C/C++ Source or Header  |  1996-11-02  |  18KB  |  831 lines

  1. /*
  2. **    About.c
  3. **
  4. **    Support routines for the `About' window.
  5. **
  6. **    Copyright © 1990-1996 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. **
  9. **    :ts=4
  10. */
  11.  
  12. #ifndef _GLOBAL_H
  13. #include "Global.h"
  14. #endif
  15.  
  16. #define HEADING 4
  17.  
  18. enum    {    GAD_FRAME=1000,GAD_SCROLL,GAD_BUTTON };
  19.  
  20.     /* LocalDeleteBitMap(struct BitMap *BitMap,LONG Width,LONG Height):
  21.      *
  22.      *    Delete yet another screen bitmap.
  23.      */
  24.  
  25. STATIC VOID
  26. LocalDeleteBitMap(struct BitMap *BitMap,LONG Width,LONG Height)
  27. {
  28.     if(BitMap)
  29.     {
  30.         LONG i;
  31.  
  32.         WaitBlit();
  33.  
  34.         for(i = 0 ; i < BitMap->Depth ; i++)
  35.         {
  36.             if(BitMap->Planes[i])
  37.                 FreeRaster(BitMap->Planes[i],Width,Height);
  38.         }
  39.  
  40.         FreeVecPooled(BitMap);
  41.     }
  42. }
  43.  
  44.     /* LocalCreateBitMap(LONG Depth,LONG Width,LONG Height):
  45.      *
  46.      *    Create yet another screen bitmap.
  47.      */
  48.  
  49. STATIC struct BitMap *
  50. LocalCreateBitMap(LONG Depth,LONG Width,LONG Height)
  51. {
  52.     struct BitMap *BitMap;
  53.  
  54.     if(BitMap = (struct BitMap *)AllocVecPooled(sizeof(struct BitMap),MEMF_ANY|MEMF_CLEAR))
  55.     {
  56.         BOOL    Success = TRUE;
  57.         LONG    i;
  58.  
  59.         InitBitMap(BitMap,Depth,Width,Height);
  60.  
  61.         for(i = 0 ; Success && i < Depth ; i++)
  62.         {
  63.             if(!(BitMap->Planes[i] = AllocRaster(Width,Height)))
  64.                 Success = FALSE;
  65.         }
  66.  
  67.         if(Success)
  68.             return(BitMap);
  69.  
  70.         LocalDeleteBitMap(BitMap,Width,Height);
  71.     }
  72.  
  73.     return(NULL);
  74. }
  75.  
  76.     /* CreateBitMapFromImage(struct Image *Image,struct BitMap *BitMap):
  77.      *
  78.      *    Turn an Intuition Image into a Gfx BitMap.
  79.      */
  80.  
  81. STATIC VOID
  82. CreateBitMapFromImage(struct Image *Image,struct BitMap *BitMap)
  83. {
  84.     PLANEPTR    Data    = (PLANEPTR)Image->ImageData;
  85.     ULONG        Modulo    = ((((ULONG)Image->Width) + 15) >> 3) & ~1;
  86.     LONG        i;
  87.  
  88.     memset(BitMap,0,sizeof(*BitMap));
  89.  
  90.     InitBitMap(BitMap,Image->Depth,Image->Width,Image->Height);
  91.  
  92.     for(i = 0 ; i < Image->Depth ; i++, Data += Modulo * Image->Height)
  93.         BitMap->Planes[i] = Data;
  94. }
  95.  
  96.     /* RecolourBitMap():
  97.      *
  98.      *    Remap a BitMap to use a different colour selection.
  99.      */
  100.  
  101. STATIC struct BitMap *
  102. RecolourBitMap (struct BitMap *Src, UBYTE * Mapping, UBYTE DestDepth, LONG Width, LONG Height)
  103. {
  104.     struct BitMap *Dst;
  105.  
  106.         /* Create the bitmap to hold the remapped data. */
  107.  
  108.     if(Dst = LocalCreateBitMap(DestDepth,Width,Height))
  109.     {
  110.         struct BitMap *SingleMap;
  111.  
  112.             /* Create a single bitplane bitmap. */
  113.  
  114.         if(SingleMap = LocalCreateBitMap(1,Width,Height))
  115.         {
  116.             struct BitMap *FullMap;
  117.  
  118.                 /* Create a dummy bitmap. */
  119.  
  120.             if(FullMap = (struct BitMap *)AllocVecPooled(sizeof(struct BitMap),MEMF_ANY | MEMF_CLEAR))
  121.             {
  122.                 LONG i,Mask = (1L << Src->Depth) - 1;
  123.  
  124.                     /* Make the dummy bitmap use the
  125.                      * single bitmap in all planes.
  126.                      */
  127.  
  128.                 InitBitMap(FullMap,DestDepth,Width,Height);
  129.  
  130.                 for(i = 0 ; i < DestDepth ; i++)
  131.                     FullMap->Planes[i] = SingleMap->Planes[0];
  132.  
  133.                     /* Clear the destination bitmap. */
  134.  
  135.                 BltBitMap(Dst,0,0,Dst,0,0,Width,Height,MINTERM_ZERO,0xFF,NULL);
  136.  
  137.                     /* Is colour zero to be mapped to a non-zero colour? */
  138.  
  139.                 if(Mapping[0])
  140.                 {
  141.                         /* Clear the single plane bitmap. */
  142.  
  143.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_ZERO,1,NULL);
  144.  
  145.                         /* Merge all source bitplane data. */
  146.  
  147.                     BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_B_OR_C,Mask,NULL);
  148.  
  149.                         /* Invert the single plane bitmap, to give us
  150.                          * the zero colour bitmap we can work with.
  151.                          */
  152.  
  153.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_NOT_C,1,NULL);
  154.  
  155.                         /* Now set all the bits for colour zero. */
  156.  
  157.                     BltBitMap(FullMap,0,0,Dst,0,0,Width,Height,MINTERM_B_OR_C,Mapping[0],NULL);
  158.                 }
  159.  
  160.                     /* Run down the colours. */
  161.  
  162.                 for(i = 1 ; i <= Mask ; i++)
  163.                 {
  164.                         /* Set the single plane bitmap to all 1's. */
  165.  
  166.                     BltBitMap(SingleMap,0,0,SingleMap,0,0,Width,Height,MINTERM_ONE,1,NULL);
  167.  
  168.                         /* Isolate the pixels to match the colour
  169.                          * specified in `i'.
  170.                          */
  171.  
  172.                     BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_B_AND_C,i,NULL);
  173.  
  174.                     if(Mask ^ i)
  175.                         BltBitMap(Src,0,0,FullMap,0,0,Width,Height,MINTERM_NOT_B_AND_C,Mask ^ i,NULL);
  176.  
  177.                         /* Set the pixels in the destination bitmap,
  178.                          * use the designated colour.
  179.                          */
  180.  
  181.                     BltBitMap(FullMap,0,0,Dst,0,0,Width,Height,MINTERM_B_OR_C,Mapping[i],NULL);
  182.                 }
  183.  
  184.                     /* Free the temporary bitmap. */
  185.  
  186.                 FreeVecPooled(FullMap);
  187.  
  188.                     /* Free the single plane bitmap. */
  189.  
  190.                 LocalDeleteBitMap(SingleMap,Width,Height);
  191.  
  192.                     /* Return the result. */
  193.  
  194.                 return(Dst);
  195.             }
  196.  
  197.             LocalDeleteBitMap(SingleMap,Width,Height);
  198.         }
  199.  
  200.         LocalDeleteBitMap(Dst,Width,Height);
  201.     }
  202.  
  203.     return(NULL);
  204. }
  205.  
  206. STATIC STRPTR Table[] =
  207. {
  208.     "\bBeta testing:",
  209.     "",
  210.     "Göran Åberg   Peter L. Banville Jr.",
  211.     "Stefan Becker   Abdelkader Benbachir",
  212.     "Sebastian Bergmann   Martin Berndt",
  213.     "Gregory A. Chance   Keith Christopher",
  214.     "Mark Constable   Steve Corder",
  215.     "Sebastian Delmont   Marcel Döring",
  216.     "Klaus Dürr   Frank Dürring",
  217.     "Bernd Ernesti   Kenneth Fribert",
  218.     "Kay Gehrke   Jay Grizzard",
  219.     "Stefan Gybas   Christoph Gülicher",
  220.     "Chris Hanson   Peer Hasselmeyer",
  221.     "Christian Hechelmann   Holger Heinrich",
  222.     "Rodney Hester   Florian Hinzmann",
  223.     "Hung-Tung Hsu   Stefan Hudson",
  224.     "Kai Iske   Piotr Kaminski",
  225.     "Jari Karjalainen   Andreas M. Kirchwitz",
  226.     "Tony Kirkland   Stellan Klebom",
  227.     "Simo Koivukoski   Jens Langner",
  228.     "Russell John LeBar   Jason C. Leach",
  229.     "Michael Leun   Holger Lubitz",
  230.     "Daniel M. Makovec   Bob Maple",
  231.     "Julian Matthew   Chris Mattingly",
  232.     "Matthias Merkel   Dabe Murphy",
  233.     "William Michael Mushkin   Christopher G. Newby",
  234.     "Dean S. Pemberton   Yves Perrenoud",
  235.     "Olaf Peters   Sven Reger",
  236.     "Robert Reiswig   Matti Rintala",
  237.     "Alfredo Rojas   Karsten Rother",
  238.     "Ottmar Röhrig   Matthias Scheler",
  239.     "Markus Schmall   Robert L. Shady",
  240.     "Leon D. Shaner   Eric W. Sommer",
  241.     "Jason Soukeras   Gary B. Standen",
  242.     "Keith A. Stewart   Joel E. Swan",
  243.     "Jonathan Tew   Bodo Thevissen",
  244.     "Alexander Wild   Jürgen Zeschky",
  245.     "Michael Zielesny",
  246.     "",
  247.     "\bForeign language translations:",
  248.     "",
  249.     "Olaf Barthel (Deutsch)",
  250.     "Phillippe Brand (Français)",
  251.     "Thomas Egrelius (Svenska)",
  252.     "Flemming Lindeblad (Dansk)",
  253.     "Andrea Suatoni (Italiano)",
  254.     "Edmund Vermeulen (Nederlands)",
  255.     "«Sorry, I lost your name» (Español)",
  256.     "",
  257.     "\bDocumentation:",
  258.     "",
  259.     "Olaf Barthel   Garry Glendown",
  260.     "Henning Hucke   Mike Safer",
  261.     "Mark Schröer",
  262.     "",
  263.     "\bXPR Libraries by:",
  264.     "",
  265.     "Marc Boucher (xmodem)",
  266.     "Terence Finney (bplus)",
  267.     "Rick Huebner & William M. Perkins (zmodem)",
  268.     "Ueli Kaufmann (ascii, ymodem, vms)",
  269.     "Marco Papa & Stephen Walton (kermit)",
  270.     "Jack Rouse (quickb)",
  271.     "",
  272.     "\bXEM Libraries by:",
  273.     "",
  274.     "Ueli Kaufmann (amiga, ascii, bbs, vt340)",
  275.     "Stef Rave (rip)",
  276.     "",
  277.     "\bPeople who will deny that",
  278.     "\bthey were ever involved:",
  279.     "",
  280.     "John Burton   Peter Fischer",
  281.     "David Göhler   Michael-Wolfgang Hohmann",
  282.     "David Jones   Marko Küchmann",
  283.     "Bernd Lambracht   Roby Leeman & AUGS",
  284.     "Frank Mariak   Germar Morgenthaler",
  285.     "Jürgen Otte   Till `Dill-Prince' Prinzler",
  286.     "Nicola Salmoria   Ralph Schmidt",
  287.     "Veith Schörgenhummer   Thorsten Seidel",
  288.     "Markus Stoll   Martin Taillefer",
  289.     "Christoph Teuber   Ralf Thanner",
  290.     "Volker Ulle & the Aquila Sysop Team   Michael Vaeth",
  291.     "Oliver Wagner   Christopher Wichura",
  292.     "Udo Wolt   Matthias Zepf",
  293.     "",
  294.     "\aDon't switch off, it's almost over!",
  295.     "",
  296.     NULL
  297. };
  298.  
  299. STATIC VOID
  300. PrintThisLine(struct RastPort *RPort,struct Rectangle *Clip,LONG Top,STRPTR Line)
  301. {
  302.     LONG Len,Width;
  303.  
  304.     Len = strlen(Line);
  305.  
  306.     if(*Line == '\b' || *Line == '\a')
  307.     {
  308.         ULONG Style;
  309.  
  310.         if(*Line == '\b')
  311.             Style = FSF_BOLD;
  312.         else
  313.             Style = FSF_ITALIC;
  314.  
  315.         SetSoftStyle(RPort,Style,FSF_BOLD | FSF_ITALIC);
  316.         Line++;
  317.         Len--;
  318.     }
  319.     else
  320.         SetSoftStyle(RPort,0,FSF_BOLD | FSF_ITALIC);
  321.  
  322.     if(Len > 0)
  323.     {
  324.         Width = TextLength(RPort,Line,Len);
  325.  
  326.         PlaceText(RPort,Clip->MinX + (Clip->MaxX - Clip->MinX + 1 - Width) / 2,Top,Line,Len);
  327.     }
  328. }
  329.  
  330.  
  331.     /* ShowAbout():
  332.      *
  333.      *    Open a window, draw the `term' logo, show some text
  334.      *    and wait for user reaction.
  335.      */
  336.  
  337. BOOL
  338. ShowAbout(LONG Ticks)
  339. {
  340.     struct BitMap        *ImageBitMap = NULL;
  341.     LONG                 ImageWidth,
  342.                          ImageHeight;
  343.     struct LayoutHandle    *Handle;
  344.     BOOL                 GotRexxMessage = FALSE;
  345.  
  346.     if(IconBase)
  347.     {
  348.         struct DiskObject *Icon;
  349.  
  350.         if(Icon = GetProgramIcon())
  351.         {
  352.             STATIC UWORD DefaultColours[4] =
  353.             {
  354.                 0xAAA,
  355.                 0x000,
  356.                 0xFFF,
  357.                 0x68B
  358.             };
  359.  
  360.             UBYTE    Mapping[4];
  361.             LONG    Colour1,Colour2;
  362.             LONG    ChannelDistance;
  363.             LONG    Distance,BestDistance,BestIndex,Depth,Count,i,j;
  364.             BOOL    Duplicates = FALSE;
  365.  
  366.             Depth = GetBitMapDepth(Window->RPort->BitMap);
  367.             Count = Window->WScreen->ViewPort.ColorMap->Count;
  368.  
  369.             if(Depth > 8)
  370.                 Depth = 8;
  371.  
  372.             if(Count > (1L << Depth))
  373.                 Count = 1L << Depth;
  374.  
  375.             if(Count > 256)
  376.                 Count = 256;
  377.  
  378.             if(Count >= 4)
  379.             {
  380.                 for(i = 0 ; i < 4 ; i++)
  381.                 {
  382.                     Colour2 = DefaultColours[i];
  383.  
  384.                     BestDistance    = 3 * 15 * 15;
  385.                     BestIndex        = 0;
  386.  
  387.                     for(j = 0 ; j < Count ; j++)
  388.                     {
  389.                         Colour1 = GetRGB4(Window->WScreen->ViewPort.ColorMap,j);
  390.  
  391.                         ChannelDistance = ((LONG)((Colour1 >> 8) & 0xF)) - ((LONG)((Colour2 >> 8) & 0xF));
  392.  
  393.                         Distance = ChannelDistance * ChannelDistance;
  394.  
  395.                         ChannelDistance = ((LONG)((Colour1 >> 4) & 0xF)) - ((LONG)((Colour2 >> 4) & 0xF));
  396.  
  397.                         Distance += ChannelDistance * ChannelDistance;
  398.  
  399.                         ChannelDistance = ((LONG)(Colour1 & 0xF)) - ((LONG)(Colour2 & 0xF));
  400.  
  401.                         Distance += ChannelDistance * ChannelDistance;
  402.  
  403.                         if(Distance < BestDistance)
  404.                         {
  405.                             BestDistance    = Distance;
  406.                             BestIndex        = j;
  407.                         }
  408.                     }
  409.  
  410.                     Mapping[i] = BestIndex;
  411.                 }
  412.  
  413.                 for(i = 0 ; !Duplicates && i < 4 ; i++)
  414.                 {
  415.                     for(j = i + 1 ; !Duplicates && j < 4 ; j++)
  416.                         Duplicates = (Mapping[i] == Mapping[j]);
  417.                 }
  418.  
  419.                 if(!Duplicates)
  420.                 {
  421.                     struct BitMap     LocalBitMap;
  422.                     struct Image    *Image;
  423.  
  424.                     Image = Icon->do_Gadget.GadgetRender;
  425.  
  426.                     if(Image->Depth == 2)
  427.                     {
  428.                         CreateBitMapFromImage(Image,&LocalBitMap);
  429.  
  430.                         if(ImageBitMap = RecolourBitMap(&LocalBitMap,Mapping,Depth,Image->Width,Image->Height))
  431.                         {
  432.                             ImageWidth    = Image->Width;
  433.                             ImageHeight    = Image->Height;
  434.                         }
  435.                     }
  436.                 }
  437.             }
  438.  
  439.             FreeDiskObject(Icon);
  440.         }
  441.     }
  442.  
  443.     if(Handle = LT_CreateHandleTags(Window->WScreen,
  444.         LAHN_LocaleHook,    &LocaleHook,
  445.         LAHN_ExactClone,    TRUE,
  446.     TAG_DONE))
  447.     {
  448.         struct Window        *PanelWindow;
  449.         struct Region        *Clip = NULL,*Old;
  450.         struct Rectangle     ClipRect;
  451.         LONG                 ClipWidth,
  452.                              ClipHeight;
  453.  
  454.         if(!Ticks)
  455.         {
  456.             struct RastPort    This;
  457.             ULONG            Width,MaxWidth,Len,i;
  458.             STRPTR            String;
  459.  
  460.             InitRastPort(&This);
  461.             SetFont(&This,UserTextFont);
  462.  
  463.             for(i = MaxWidth = 0 ; Table[i] ; i++)
  464.             {
  465.                 Len = strlen(String = Table[i]);
  466.  
  467.                 if(*String == '\b' || *String == '\a')
  468.                 {
  469.                     ULONG Style;
  470.  
  471.                     if(*String == '\b')
  472.                         Style = FSF_BOLD;
  473.                     else
  474.                         Style = FSF_ITALIC;
  475.  
  476.                     SetSoftStyle(&This,Style,FSF_BOLD | FSF_ITALIC);
  477.                     String++;
  478.                     Len--;
  479.                 }
  480.                 else
  481.                     SetSoftStyle(&This,0,FSF_BOLD | FSF_ITALIC);
  482.  
  483.                 if(Len > 0)
  484.                 {
  485.                     Width = TextLength(&This,String,Len);
  486.  
  487.                     if(Width > MaxWidth)
  488.                         MaxWidth = Width;
  489.                 }
  490.             }
  491.  
  492.             ClipWidth    = MaxWidth;
  493.             ClipHeight    = HEADING * This.TxHeight;
  494.  
  495.             Clip = NewRegion();
  496.         }
  497.  
  498.         LT_New(Handle,
  499.             LA_Type,VERTICAL_KIND,
  500.         TAG_DONE);
  501.         {
  502.             LT_New(Handle,
  503.                 LA_Type,        VERTICAL_KIND,
  504.                 LA_LabelText,    TermName,
  505.             TAG_DONE);
  506.             {
  507.                 if(ImageBitMap)
  508.                 {
  509.                     LT_New(Handle,
  510.                         LA_Type,VERTICAL_KIND,
  511.                     TAG_DONE);
  512.                     {
  513.                         LT_New(Handle,
  514.                             LA_Type,            FRAME_KIND,
  515.                             LAFR_InnerWidth,    ImageWidth,
  516.                             LAFR_InnerHeight,    ImageHeight,
  517.                             LAFR_DrawBox,        FALSE,
  518.                             LA_ID,                GAD_FRAME,
  519.                         TAG_DONE);
  520.  
  521.                         LT_EndGroup(Handle);
  522.                     }
  523.                 }
  524.  
  525.                 LT_New(Handle,
  526.                     LA_Type,VERTICAL_KIND,
  527.                 TAG_DONE);
  528.                 {
  529.                     LT_New(Handle,
  530.                         LA_Type,        BOX_KIND,
  531.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT1_TXT,
  532.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT2_TXT,
  533.                         LABX_AlignText,    ALIGNTEXT_Centered,
  534.                         LABX_DrawBox,    FALSE,
  535.                     TAG_DONE);
  536.  
  537.                     LT_EndGroup(Handle);
  538.                 }
  539.  
  540.                 if(!Ticks && Clip)
  541.                 {
  542.                     LT_New(Handle,
  543.                         LA_Type,VERTICAL_KIND,
  544.                     TAG_DONE);
  545.                     {
  546.                         LT_New(Handle,
  547.                             LA_Type,XBAR_KIND,
  548.                         TAG_DONE);
  549.  
  550.                         LT_New(Handle,
  551.                             LA_Type,            FRAME_KIND,
  552.                             LAFR_InnerWidth,    ClipWidth + 4,
  553.                             LAFR_InnerHeight,    ClipHeight + 2,
  554.                             LAFR_DrawBox,        FALSE,
  555.                             LA_ID,                GAD_SCROLL,
  556.                         TAG_DONE);
  557.  
  558.                         LT_EndGroup(Handle);
  559.                     }
  560.                 }
  561.  
  562.                 LT_EndGroup(Handle);
  563.             }
  564.  
  565.             LT_New(Handle,
  566.                 LA_Type,    VERTICAL_KIND,
  567.                 LA_LabelID,    MSG_V36_1030,
  568.             TAG_DONE);
  569.             {
  570.                 LT_New(Handle,
  571.                     LA_Type,VERTICAL_KIND,
  572.                 TAG_DONE);
  573.                 {
  574.                     LT_New(Handle,
  575.                         LA_Type,        BOX_KIND,
  576.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT4_TXT,
  577.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT6_TXT,
  578.                         LABX_AlignText,    ALIGNTEXT_Centered,
  579.                         LABX_DrawBox,    FALSE,
  580.                     TAG_DONE);
  581.  
  582.                     LT_EndGroup(Handle);
  583.                 }
  584.  
  585.                 LT_New(Handle,
  586.                     LA_Type,    VERTICAL_KIND,
  587.                     LA_LabelID,    MSG_V36_1031,
  588.                 TAG_DONE);
  589.                 {
  590.                     LT_New(Handle,
  591.                         LA_Type,        BOX_KIND,
  592.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT10_TXT,
  593.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT12_TXT,
  594.                         LABX_AlignText,    ALIGNTEXT_Centered,
  595.                         LABX_DrawBox,    FALSE,
  596.                     TAG_DONE);
  597.  
  598.                     LT_EndGroup(Handle);
  599.                 }
  600.  
  601.                 LT_New(Handle,
  602.                     LA_Type,    VERTICAL_KIND,
  603.                     LA_LabelID,    MSG_V36_1032,
  604.                 TAG_DONE);
  605.                 {
  606.                     LT_New(Handle,
  607.                         LA_Type,        BOX_KIND,
  608.                         LABX_FirstLine,    MSG_TERMINFO_INFOTEXT16_TXT,
  609.                         LABX_LastLine,    MSG_TERMINFO_INFOTEXT16_TXT,
  610.                         LABX_AlignText,    ALIGNTEXT_Centered,
  611.                         LABX_DrawBox,    FALSE,
  612.                     TAG_DONE);
  613.  
  614.                     LT_EndGroup(Handle);
  615.                 }
  616.  
  617.                 LT_EndGroup(Handle);
  618.             }
  619.  
  620.             if(!Ticks)
  621.             {
  622.                 LT_New(Handle,
  623.                     LA_Type,VERTICAL_KIND,
  624.                 TAG_DONE);
  625.                 {
  626.                     LT_New(Handle,
  627.                         LA_Type,        XBAR_KIND,
  628.                         LAXB_FullSize,    TRUE,
  629.                     TAG_DONE);
  630.  
  631.                     LT_New(Handle,
  632.                         LA_Type,        BUTTON_KIND,
  633.                         LA_LabelID,        MSG_V36_1033,
  634.                         LA_ID,            GAD_BUTTON,
  635.                         LABT_ReturnKey,    TRUE,
  636.                         LABT_ExtraFat,    TRUE,
  637.                     TAG_DONE);
  638.  
  639.                     LT_EndGroup(Handle);
  640.                 }
  641.             }
  642.  
  643.             LT_EndGroup(Handle);
  644.         }
  645.  
  646.         if(PanelWindow = LT_Build(Handle,
  647.             LAWN_IDCMP,        Ticks ? (IDCMP_RAWKEY | IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_INTUITICKS) : (IDCMP_INTUITICKS),
  648.  
  649.             LAWN_HelpHook,    &GuideHook,
  650.             LAWN_MaxPen,    -1,
  651.             LAWN_Parent,    Window,
  652.             WA_RMBTrap,        TRUE,
  653.             WA_Activate,    TRUE,
  654.             WA_ReportMouse,    TRUE,
  655.  
  656.             Ticks ? TAG_DONE : TAG_IGNORE,0,
  657.  
  658.             WA_DepthGadget,    TRUE,
  659.             WA_DragBar,        TRUE,
  660.             LAWN_TitleID,    MSG_V36_1034,
  661.         TAG_DONE))
  662.         {
  663.             struct IntuiMessage    *Message;
  664.             BOOL                 Done = FALSE;
  665.             ULONG                 MsgClass,
  666.                                  MsgQualifier;
  667.             UWORD                 MsgCode;
  668.             struct Gadget        *MsgGadget;
  669.             ULONG                 Signals;
  670.             LONG                 TickCount = 0;
  671.             LONG                 Top,Total,LastLine,IntroTicks = 15;
  672.             struct RastPort        *RPort = PanelWindow->RPort;
  673.  
  674.             if(ImageBitMap)
  675.             {
  676.                 LONG LocalLeft,LocalTop;
  677.  
  678.                 LT_GetAttributes(Handle,GAD_FRAME,
  679.                     LA_Left,    &LocalLeft,
  680.                     LA_Top,        &LocalTop,
  681.                 TAG_DONE);
  682.  
  683.                 BltBitMapRastPort(ImageBitMap,0,0,RPort,LocalLeft,LocalTop,ImageWidth,ImageHeight,MINTERM_COPY);
  684.             }
  685.  
  686.             if(!Ticks)
  687.             {
  688.                 LONG LeftEdge,TopEdge;
  689.  
  690.                 LT_GetAttributes(Handle,GAD_SCROLL,
  691.                     LA_Left,    &LeftEdge,
  692.                     LA_Top,        &TopEdge,
  693.                 TAG_DONE);
  694.  
  695.                 ClipRect.MinX = LeftEdge + 2;
  696.                 ClipRect.MinY = TopEdge + 2;
  697.                 ClipRect.MaxX = LeftEdge + 2 + ClipWidth - 1;
  698.                 ClipRect.MaxY = TopEdge + 2 + ClipHeight - 1;
  699.  
  700.                 SetFont(RPort,UserTextFont);
  701.                 SetPens(RPort,Pens[TEXTPEN],Pens[BACKGROUNDPEN],JAM2);
  702.  
  703.                 if(OrRectRegion(Clip,&ClipRect))
  704.                 {
  705.                     LONG i;
  706.  
  707.                     Old = InstallClipRegion(PanelWindow->WLayer,Clip);
  708.  
  709.                     Top = ClipRect.MinY;
  710.  
  711.                     for(i = 0 ; i < HEADING ; i++)
  712.                     {
  713.                         PrintThisLine(RPort,&ClipRect,Top,Table[i]);
  714.  
  715.                         Top += RPort->TxHeight;
  716.                     }
  717.  
  718.                     LastLine = i;
  719.  
  720.                     Total = 0;
  721.                 }
  722.                 else
  723.                 {
  724.                     DisposeRegion(Clip);
  725.                     Clip = NULL;
  726.                 }
  727.             }
  728.  
  729.             while(Message = GT_GetIMsg(PanelWindow->UserPort))
  730.                 GT_ReplyIMsg(Message);
  731.  
  732.             if(!Ticks)
  733.                 PushWindow(PanelWindow);
  734.             else
  735.                 Say(LocaleString(MSG_TERMINFO_WELCOME_TO_TERM_TXT));
  736.  
  737.             do
  738.             {
  739.                 Signals = Wait(PORTMASK(PanelWindow->UserPort) | SIG_BREAK | SIG_REXX);
  740.  
  741.                 if(Signals & SIG_BREAK)
  742.                     break;
  743.  
  744.                 if(Ticks)
  745.                 {
  746.                     if(Signals & SIG_REXX)
  747.                     {
  748.                         GotRexxMessage = TRUE;
  749.  
  750.                         break;
  751.                     }
  752.                 }
  753.  
  754.                 while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow->UserPort))
  755.                 {
  756.                     MsgClass        = Message->Class;
  757.                     MsgQualifier    = Message->Qualifier;
  758.                     MsgCode            = Message->Code;
  759.                     MsgGadget        = (struct Gadget *)Message->IAddress;
  760.  
  761.                     GT_ReplyIMsg(Message);
  762.  
  763.                     if(Ticks)
  764.                     {
  765.                         if(MsgClass == IDCMP_INTUITICKS && TickCount++ >= 50)
  766.                             Done = TRUE;
  767.  
  768.                         if((MsgClass == IDCMP_RAWKEY || MsgClass == IDCMP_MOUSEBUTTONS) && !(MsgCode & IECODE_UP_PREFIX))
  769.                             Done = TRUE;
  770.  
  771.                         if(MsgClass == IDCMP_MOUSEMOVE)
  772.                             Done = TRUE;
  773.                     }
  774.                     else
  775.                     {
  776.                         LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
  777.  
  778.                         if(MsgClass == IDCMP_GADGETUP)
  779.                             Done = TRUE;
  780.  
  781.                         if(MsgClass == IDCMP_INTUITICKS && Clip)
  782.                         {
  783.                             if(IntroTicks > 0)
  784.                                 IntroTicks--;
  785.                             else
  786.                             {
  787.                                 ScrollRaster(RPort,0,1,ClipRect.MinX,ClipRect.MinY,ClipRect.MaxX,ClipRect.MaxY);
  788.  
  789.                                 BeginRefresh(Handle->Window);
  790.                                 EndRefresh(Handle->Window,TRUE);
  791.  
  792.                                 Total++;
  793.  
  794.                                 PrintThisLine(RPort,&ClipRect,Top - Total,Table[LastLine]);
  795.  
  796.                                 if(Total == RPort->TxHeight)
  797.                                 {
  798.                                     Total = 0;
  799.  
  800.                                     LastLine++;
  801.  
  802.                                     if(!Table[LastLine])
  803.                                         LastLine = 0;
  804.                                 }
  805.                             }
  806.                         }
  807.                     }
  808.                 }
  809.             }
  810.             while(!Done);
  811.  
  812.             if(Clip)
  813.             {
  814.                 InstallClipRegion(PanelWindow->WLayer,Old);
  815.  
  816.                 DisposeRegion(Clip);
  817.             }
  818.  
  819.             if(!Ticks)
  820.                 PopWindow();
  821.         }
  822.  
  823.         LT_DeleteHandle(Handle);
  824.     }
  825.  
  826.     if(ImageBitMap)
  827.         LocalDeleteBitMap(ImageBitMap,ImageWidth,ImageHeight);
  828.  
  829.     return(GotRexxMessage);
  830. }
  831.